package com.ssm.Structure;

import com.ssm.Structure.Bean1;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class InstanceTest {
    public static void main(String[] args) {
        //定义配置文件路径
        String xmlPath="Spring-bean1.xml";
        //ApplicationContext 在加载配置文件时，对Bean进行实例化
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext(xmlPath);
        Bean1 bean1 = (Bean1) applicationContext.getBean("bean1");
        System.out.println(bean1); //成功打印对象地址
    }
}
